//
// Created by mayn on 2019/10/3.
// C++ 支持多继承, 并且可添加基类继承修饰来控制访问
//
#include <iostream>
#include <string>

using namespace std;

class A {
public:
    string name;
};

class C {
public:
    int age;
};

// C++ 支持多继承, B 继承 A 得到 name 属性, 继承 C 得到 age 属性
class B:public A, public C {
public:
    B(int age, string name);
    void sayAge();
    void sayName();
};

/**
 * 构造方法
 * */
B::B(int age, string name) {
    this->age = age;
    this->name = name;
}

/**
 * sayAge
 * */
void B::sayAge() {
    cout << this->age << endl;
}

/**
 * sayName
 * */
void B::sayName() {
    cout << this->name << endl;
}

int main() {
    A a;
    B b(19, "Jack");
    b.sayAge();
    b.sayName();
    return 0;
}
